package com.demo.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.demo.entity.KeShiBiao;
import com.demo.entity.YiSheng;
import com.demo.service.DoctorService;
import com.demo.service.TuiJianDoctorServie;

import net.sf.json.JSONObject;

@RestController
@CrossOrigin
@RequestMapping("/doctor")
public class DoctorController {
	
	@Autowired
	private DoctorService doctorService;
	
	@Autowired
	private TuiJianDoctorServie tuiJianDoctorServie;
	
	@RequestMapping("/selectAll")
	public List<YiSheng> selectAll(){
    	return doctorService.selectAll();
    }
	
	//科室查医生
	@RequestMapping("/findyishengBykeshi")
	public List<YiSheng> findyishengBykeshi(String keshi){
		return doctorService.findyishengBykeshi(keshi);
	}
	
	//科室查医生
	@RequestMapping("/findyishengByid")
	public YiSheng findyishengByid(int id){
		return doctorService.selectByPrimaryKey(id);
	}
	
	@RequestMapping("/recommand")
	public JSONObject recommand(String yonghu,String miaoshu) {
		if(yonghu==""||yonghu.length()==0) {
			yonghu = "temp_user";
		}
		return tuiJianDoctorServie.recommand(yonghu, miaoshu);
	}

}
